home *** CD-ROM | disk | FTP | other *** search
/ PC Home 49 / PC_Home_Issue_49.iso / lldemo / lldemo.shr / ROSETTA.EXE / ROSETTA.DXR / 00592_new chapter scripts.ls < prev    next >
Encoding:
Text File  |  1996-06-24  |  4.0 KB  |  129 lines

  1. on newChap
  2.   global gPathList, gNormSize, gNumPages, gSmallSize, gNewChap, gPatch, gPlace, gMode, gCurQuad, gPatchSnd, gType, gEsPatch
  3.   if gPlace = #title then
  4.     cursor(4)
  5.     puppetSprite(13, 1)
  6.     puppetSprite(14, 1)
  7.     spriteBox(13, 280, 235, 478, 245)
  8.     updateStage()
  9.   end if
  10.   set unit to ChapStr2Unit(gNewChap)
  11.   set chapter to ChapStr2Chap(gNewChap)
  12.   set language to ChapStr2Language(gNewChap)
  13.   initFilter(language)
  14.   set gPathList to findChapPaths(language, unit, chapter)
  15.   set count to 0
  16.   repeat while (gPathList = [:]) and (count < 1)
  17.     alert("Chapter " & gNewChap & " is not currently available. Insert its disk and try again.")
  18.     findChapLocs()
  19.     set count to count + 1
  20.     set gPathList to findChapPaths(language, unit, chapter)
  21.   end repeat
  22.   if gPathList = [:] then
  23.     alert("Required chapter " & gNewChap & " not found. See system administrator.")
  24.     goQuit()
  25.     return 1
  26.   end if
  27.   set the text of cast "Menu Unit-Chapter" to string(((unit - 1) * 11) + chapter)
  28.   set the text of cast "Play Unit-Chapter" to string(((unit - 1) * 11) + chapter)
  29.   set path to getaProp(gPathList, #textPath)
  30.   if gPlace = #title then
  31.     spriteBox(14, 280, 235, 280 + 33, 245)
  32.     updateStage()
  33.   end if
  34.   set info to readTextFast(path)
  35.   if gPlace = #title then
  36.     spriteBox(14, 280, 235, 280 + 66, 245)
  37.     updateStage()
  38.   end if
  39.   if info = "Error" then
  40.     alert("Error reading chapter text for " & gNewChap & ". Be sure the chapter is available.")
  41.     return 1
  42.   end if
  43.   set lang to item 2 of info
  44.   set the text of cast "Language" to lang
  45.   set gNumPages to value(item 5 of info)
  46.   set Font to item 6 of info
  47.   if Font = "Rosetta Roman" then
  48.     set Font to "Times New Roman"
  49.   end if
  50.   if (gType = #PC) and (Font = "Times") then
  51.     set Font to "Times New Roman"
  52.   end if
  53.   set gNormSize to value(item 7 of info)
  54.   set gSmallSize to value(item 8 of info)
  55.   if getaProp(gPathList, #type) = 1 then
  56.     set gPatch to gNewChap = "English 05-06"
  57.     patchText(gNewChap)
  58.   end if
  59.   set gPatchSnd to gNewChap = "Russian 01-01"
  60.   set gEsPatch to gNewChap = "Espa├▒ol 03-10"
  61.   initQuads()
  62.   if gPlace = #title then
  63.     set gMode to "111"
  64.     newPage(gCurQuad, unit, chapter, 1)
  65.     repeat with i = 1 to 4
  66.       if getPict(1) = 0 then
  67.         alert("Error reading pictures for " & gNewChap & ". Be sure the chapter is available.")
  68.         return 1
  69.       end if
  70.       spriteBox(14, 280, 235, 280 + ((i + 2) * 33), 245)
  71.       updateStage()
  72.     end repeat
  73.   end if
  74.   set titleFont to Font
  75.   set the textFont of cast "Language" to titleFont
  76.   if the textFont of cast "Language" <> titleFont then
  77.     alert("This chapter requires the font " & titleFont & ".  Another font will be substituted.  Text may not appear correctly.")
  78.   end if
  79.   repeat with i = 0 to 2
  80.     set the text of cast (42 + i) to " "
  81.     set the textFont of cast (42 + i) to Font
  82.     set the textSize of cast (42 + i) to gNormSize
  83.   end repeat
  84.   repeat with i = 0 to 3
  85.     set the text of cast (49 + i) to " "
  86.     set the textFont of cast (49 + i) to Font
  87.     set the textSize of cast (49 + i) to gNormSize
  88.     set the text of cast (113 + i) to " "
  89.     set the textFont of cast (113 + i) to Font
  90.     set the textSize of cast (113 + i) to gNormSize
  91.   end repeat
  92.   if gPlace = #title then
  93.     puppetSprite(13, 0)
  94.     puppetSprite(14, 0)
  95.     cursor(-1)
  96.   end if
  97.   return 0
  98. end
  99.  
  100. on readTextFast path
  101.   global gType
  102.   set txt to readTextFile(path)
  103.   if gType = #PC then
  104.     if item 6 of txt = "Times" then
  105.       set txt to filterText(txt)
  106.     else
  107.       if item 6 of txt = "Cyrillic" then
  108.         set txt to filterCyrillic(txt)
  109.       else
  110.         if item 6 of txt = "Rosetta Roman" then
  111.           set txt to filterRosettaRoman(txt)
  112.         end if
  113.       end if
  114.     end if
  115.   end if
  116.   if word 1 of txt = "#Error" then
  117.     set info to "Error"
  118.   else
  119.     set the itemDelimiter to "@"
  120.     set info to item 1 of txt
  121.     repeat with i = 0 to 39
  122.       set newline to item i + 2 of txt
  123.       put newline into field (345 + i)
  124.     end repeat
  125.     set the itemDelimiter to ","
  126.   end if
  127.   return info
  128. end
  129.